// packageProduct/pages/detail/elements/elements.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        detail: {
            type: Object,
            value: {}
        }
    },

    /**
     * 组件的初始数据
     */
    data: {

    },

    /*
    * 数据监听
    * */
    observers: {
        "detail": function (val) {
            if (val && Object.keys(val).length > 0) {
                this.setData({
                    _detail: {
                        c_fund_name: val.c_fund_name || "--",
                        c_fund_type: val.c_fund_type  || "--",
                        c_fund_status: val.c_fund_status || "--",
                        c_fund_manager_org: val.c_fund_manager_org || "--",
                        c_fund_custodian: val.c_fund_custodian || "--",
                        c_fund_consultant: val.c_fund_consultant || "--",
                        t_foundation_date: val.t_foundation_date || "--",
                        c_open_rule: (function () {
                            let c_open_rule = val.c_open_rule;
                            let c_open_rule_remark = val.c_open_rule_remark;
                            if (c_open_rule || c_open_rule_remark) {
                                if (c_open_rule && c_open_rule_remark) {
                                    return c_open_rule + "（备注： " + c_open_rule_remark + "）"
                                } else if (!c_open_rule) {
                                    return "（备注： " + c_open_rule_remark + "）"
                                } else {
                                    return c_open_rule
                                }
                            } else {
                                return "--"
                            }
                        })(),
                        n_warning_line: val.n_warning_line || "--",
                        n_stop_loss_line: val.n_stop_loss_line || "--"
                    }
                })
            }
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {

    }
})
